<?php 
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu();
$cates = pdo_getall('snx_unit',array('uniacid'=>$_W['uniacid'],'id'=>$_GPC['unit_id']));
$info = pdo_get('snx_task',array('id'=>$_GPC['id']));
if(checksubmit('submit')){
        $data['unit_id']=$_GPC['name'];
        $data['title']=$_GPC['title'];
        $data['video']=$_GPC['video'];
        $data['thumb']=$_GPC['thumb'];
        $data['describe']=$_GPC['describe'];
        $data['voice']=$_GPC['voice'];
        $data['create_time']=date('Y-m-d H:i:s',time());
        $data['uniacid']=$_W['uniacid'];

            // var_dump($data);die;
        if (empty($_GPC['title'])) {

            message('题目不能为空','','error');
        }
        if (empty($_GPC['name'])) {

            message('课节不能为空','','error');

        }
        if(!empty($_GPC['title']) && !empty($_GPC['name'])){
            $rst=pdo_update('snx_task',$data,array('id'=>$_GPC['id']));
            if($rst){
                 message('编辑成功！', $this->createWebUrl('task',array('id'=>$info['unit_id'])), 'success');
            }else{
                 message('编辑失败！','','error');
            }
        }
}
include $this->template('web/addtask');